﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace DesignByContract.CodeContracts
{
    public class LDD : IInterest
    {
        /// <summary>
        /// Inherites interface contracts, adds additional contracts
        /// </summary>
        /// <param name="amount"></param>
        /// <param name="rate"></param>
        /// <returns></returns>
        public virtual double ComputeInterest(double amount, double rate)
        {
            //Additional Pre-Condition
            Contract.Requires(rate > 0, "The interest rate must be higher than 0.");

            return amount + amount * rate;
        }
    }
}
